# 生成big.data文件
import string
import random
with open('big.data', 'w+',encoding = "utf-8") as f:
	for i in range(1200000):
		f.write(random.choice("dingchengxing\n"))
		i+=1
f = open('big.data')
longestLine = max(len(line.strip()) for line in f)
f.close()
print(longestLine)

# 得到最长行数
f = open('big.data')
allLines = [line.strip() for line in f]
f.close()

longest = 0
longLine = ""
for line in allLines:
    linelen = len(line)
    if linelen > longest:
        longest = linelen
        longLine = line
print('Longest line: %s' % longLine)
print('The number of longest line: %s' % longest)
